import {request} from "../request";
import {utils} from "../../common/utils";

// 创建离职
export function add(val){
    console.log("离职申请创建 -> ",val)
    return request({
        url:'/resign',
        method:'post',
        data:val
    })
}

// 查询离职员工
export function selAll(pageNum, pageSize){
    return request({
        url:'/resign',
        method:'get',
        params:{
            pageNum,
            pageSize
        }
    })
}

// 驳回离职
export function uptByResId(res){
    let resids = utils.joinArrayReqParam(res,'rids');

    return request({
        url:'/resign/' + resids,
        method:'put',
    })
}

// 同意离职
export function delByResId(res){
    let resids = utils.joinArrayReqParam(res,'rids');

    return request({
        url:'/resign/' + resids,
        method:'delete',
    })
}

// 创建调岗
export function adddj(val){
    console.log("调岗创建 -> ",val)
    return request({
        url:'/positionTransfer/add',
        method:'post',
        data:val
    })
}

// 查询调岗员工
export function selAllPos(pageNum, pageSize){
    return request({
        url:'/positionTransfer',
        method:'get',
        params:{
            pageNum,
            pageSize
        }
    })
}

// 同意转岗
export function aByPosId(res){
    let posIds = utils.joinArrayReqParam(res,'rids');
    return request({
        url:'/positionTransfer/' + posIds,
        method:'put',
    })
}

// 取消转岗
export function cByPosId(res){
    let posIds = utils.joinArrayReqParam(res,'rids');
    return request({
        url:'/positionTransfer/' + posIds,
        method:'delete',
    })
}